package com.dynamic.sync.toolkit.controller;

import com.dynamic.sync.toolkit.mongo.sync.request.SyncFromPrdReq;
import com.dynamic.sync.toolkit.mongo.sync.request.SyncFromDevReq;
import com.dynamic.sync.toolkit.mongo.sync.request.SyncFromPreReq;
import com.dynamic.sync.toolkit.mongo.sync.request.SyncFromTestReq;
import com.dynamic.sync.toolkit.mongo.sync.request.SyncSourceToTargetReq;
import com.dynamic.sync.toolkit.mongo.sync.service.MongoSyncService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ZonLen since on 2021/6/19 下午8:19
 */
@RestController
@RequestMapping("/syncMongo")
public class SyncMongoController {

  @Autowired
  private MongoSyncService mongoSyncService;

  @PostMapping("/sourceToTarget")
  public String sourceToTarget(@RequestBody SyncSourceToTargetReq req){
    mongoSyncService.syncSourceToTarget(req);
    return "SUCCESS";
  }

  @PostMapping("/syncFromPrd")
  public String fromPrd(@RequestBody SyncFromPrdReq req){
    mongoSyncService.syncFromPrd(req);
    return "SUCCESS";
  }


  @PostMapping("/syncFromPre")
  public String fromPre(@RequestBody SyncFromPreReq req){
    mongoSyncService.syncFromPre(req);
    return "SUCCESS";
  }

  @PostMapping("/syncFromDev")
  public String mongo(@RequestBody SyncFromDevReq req){
    mongoSyncService.syncFromDev(req);
    return "SUCCESS";
  }

  @PostMapping("/syncFromTest")
  public String syncFromTest(@RequestBody SyncFromTestReq req){
    mongoSyncService.syncFromTest(req);
    return "SUCCESS";
  }

}
